﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using Model.Queries;
using Model;
using Model.IRepository;
using Lib.Query;
using DataAccess.NHibernate;

namespace WcfTest
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class PolicyService : IPolicyService
    {
        public Policy[] FindBy(LiteQuery<Policy> query)
        {            
            NHSessionFactory.Init();
            IPolicyRepository repository;
            repository = new DataAccess.NHibernate.PolicyRepository();
            return repository.FindBy<Policy>(query).ToArray<Policy>();            
        }

        public Policy[] FindByPredefined(PolicyQuery query)
        {
            return FindBy(query);
        }
    }
}
